package com.example.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/calc")
public class Demo3 {

    @RequestMapping("/d1")
    public String d1(Integer num1, Integer num2) {
        if (num1 == null || num2 == null) {
            return "error";
        }
        Integer sum = num1 + num2;
        return "<h1>计算结果：" + sum + "</h1>";

    }

    @RequestMapping("/calc1")
    public String calc1(Integer num1, Integer num2) {
        if (num1 == null || num2 == null) {
            return "error";
        }
        Integer sum = num1 + num2;
        return "<h1>计算结果：" + sum + "</h1>";
    }


}
